package P4.T01;

import java.util.Random;

public class T01 {
    public static void main(String[] args) {
        MyStack<Cat> cats = new MyStack<Cat>();
        Random rand = new Random();
        for (int i = 0; i < 100; i++) {
            boolean op=rand.nextInt(5)<=2;
            try {
                if (op) cats.push(new Cat("miao" + i));
                else cats.pop();
            }
            catch (EmptyStackException e) {
                System.out.println("栈已空，不能出栈");
                break;
            }
            catch(FullStackException e){
                System.out.println("栈已满，不能再入栈");
                break;
            }
        }
    }
}
